package com.ruoyi.inventory.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.LostScrap;
import com.ruoyi.inventory.domain.LostScrapDetail;
import com.ruoyi.inventory.mapper.LostScrapMapper;
import com.ruoyi.inventory.service.ILostScrapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.text.Convert;

/**
 * 遗失报废Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-07-01
 */
@Service
public class LostScrapServiceImpl implements ILostScrapService
{
    @Autowired
    private LostScrapMapper lostScrapMapper;

    /**
     * 查询遗失报废
     * 
     * @param id 遗失报废ID
     * @return 遗失报废
     */
    @Override
    public LostScrap selectLostScrapById(Long id)
    {
        return lostScrapMapper.selectLostScrapById(id);
    }

    /**
     * 查询遗失报废列表
     * 
     * @param lostScrap 遗失报废
     * @return 遗失报废
     */
    @Override
    public List<LostScrap> selectLostScrapList(LostScrap lostScrap)
    {
        return lostScrapMapper.selectLostScrapList(lostScrap);
    }

    /**
     * 新增遗失报废
     * 
     * @param lostScrap 遗失报废
     * @return 结果
     */
    @Override
    public int insertLostScrap(LostScrap lostScrap)
    {
        lostScrap.setCreateTime(DateUtils.getNowDate());
        return lostScrapMapper.insertLostScrap(lostScrap);
    }

    /**
     * 修改遗失报废
     * 
     * @param lostScrap 遗失报废
     * @return 结果
     */
    @Override
    public int updateLostScrap(LostScrap lostScrap)
    {
        lostScrap.setUpdateTime(DateUtils.getNowDate());
        return lostScrapMapper.updateLostScrap(lostScrap);
    }

    /**
     * 删除遗失报废对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteLostScrapByIds(String ids)
    {
        return lostScrapMapper.deleteLostScrapByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除遗失报废信息
     * 
     * @param id 遗失报废ID
     * @return 结果
     */
    @Override
    public int deleteLostScrapById(Long id)
    {
        return lostScrapMapper.deleteLostScrapById(id);
    }

    /**
     * 查询遗失报废详细
     * @param lostScrapDetail
     * @return
     */
    @Override
    public List<LostScrapDetail> selectLostScrapDetailList(LostScrapDetail lostScrapDetail) {
        return lostScrapMapper.selectLostScrapDetailList(lostScrapDetail);
    }

    /**
     * 批量插入遗失报废
     * @param lostScrapList
     * @return
     */
    @Override
    public int insertLostScraps(List<LostScrap> lostScrapList) {
        return lostScrapMapper.insertLostScraps(lostScrapList);
    }
}
